package com.wz.dhs.config;

import com.wz.dhs.config.properties.WxPayConfig;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PayConfig {


    @Bean
    public RSAAutoCertificateConfig rsaAutoCertificateConfig(WxPayConfig wxPayConfig) {
        RSAAutoCertificateConfig config = new RSAAutoCertificateConfig.Builder()
                .merchantId(wxPayConfig.getMerchantId())
                .privateKey(wxPayConfig.getPrivateKey())
                .merchantSerialNumber(wxPayConfig.getMerchantSerialNumber())
                .apiV3Key(wxPayConfig.getApiV3key())
                .build();
        return config;
    }


}
